package eraserhead.controller;

import java.awt.Font;
import java.awt.Rectangle;

import javax.swing.JLabel;
import javax.swing.JPanel;

import eraserhead.boundary.DecisionGUI;
import eraserhead.entity.Decision;

/**
 * Controller for ending a {@link Decision} event.
 * @author Greg
 * @author Michael Checca
 */
public class EndController {
	
	Decision model;
	DecisionGUI view;

	public EndController(Decision model, DecisionGUI view)
	{
		this.model = model;
		this.view = view;
	}
	
	
	public void showResults() {
		view.getLinesCanvas().setEnabled(false);
		view.getLinesCanvas().setVisible(false);
		//view.getChoicePanel().setEnabled(false);
		//view.getChoicePanel().setVisible(false);
		String results = model.finish();
		/* Create new label and store Decision results in it */
		JLabel lblResults = new JLabel();
		lblResults.setBounds(new Rectangle(10, 10, 75, 50));
		lblResults.setFont(new Font("Felix Titling", Font.PLAIN, 24));
		lblResults.setText(results);
		JPanel pnlDecisions = new JPanel();
		Rectangle bounds = view.getLinesCanvas().getBounds();
		pnlDecisions.setBounds(new Rectangle(bounds.x, bounds.y + 100, bounds.width, bounds.height));
		pnlDecisions.add(lblResults);
		view.add(pnlDecisions);
		view.repaint();
	}
}
